package com.wormhole.wormholemanagement.service.impl;

import com.wormhole.wormholemanagement.entity.OperationLog;
import com.wormhole.wormholemanagement.repository.OperationLogRepository;
import com.wormhole.wormholemanagement.service.OperationLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;

@Service
public class OperationLogServiceImpl implements OperationLogService {

    private final OperationLogRepository logRepository;

    @Autowired
    public OperationLogServiceImpl(OperationLogRepository logRepository) {
        this.logRepository = logRepository;
    }

    @Override
    public Page<OperationLog> getAllLogs(Pageable pageable) {
        return logRepository.findAll(pageable);
    }

    @Override
    public Page<OperationLog> searchLogs(Specification<OperationLog> spec, Pageable pageable) {
        return logRepository.findAll(spec, pageable);
    }
}